import axios from '@/utils/request'

// 材料
// 材料基本信息列表
export const pageMaterail = (params) => {
  return axios({
    method: 'GET',
    url: 'basicInfo/pageMaterail',
    params
  })
}
// 材料基本信息详情
export const materailBasicInfoDetail = (materailId) => {
  return axios({
    method: 'GET',
    url: `basicInfo/materailBasicInfoDetail/${materailId}`
  })
}
// 新增
export const newMaterailBasicInfo = (data) => {
  return axios({
    method: 'POST',
    url: 'basicInfo/newMaterailBasicInfo',
    data
  })
}
// 编辑
export const updateMaterailBasicInfo = (data) => {
  return axios({
    method: 'POST',
    url: 'basicInfo/updateMaterailBasicInfo',
    data
  })
}
// 提交审批
export const submitMaterailProcess = (materailId) => {
  return axios({
    method: 'POST',
    url: `basicInfo/submitMaterailProcess/${materailId}`
  })
}
// 导出
export function exportMaterail (params) {
  return axios({
    url: 'basicInfo/exportMaterail',
    method: 'GET',
    params,
    responseType: 'blob'
  })
}
// 下载导入模板
export function downloadMaterailTemplate () {
  return axios({
    url: 'basicInfo/downloadMaterailTemplate',
    method: 'GET',
    responseType: 'blob'
  })
}
// 导入
export function importMaterail (data) {
  return axios({
    url: 'basicInfo/importMaterail',
    method: 'GET',
    data
  })
}

// 仓库
// 分页
export const pageRepository = (params) => {
  return axios({
    method: 'GET',
    url: 'repository/pageRepository',
    params
  })
}
// 仓库详情
export const queryRepositoryDetail = (repositoryId) => {
  return axios({
    method: 'GET',
    url: `repository/queryRepositoryDetail/${repositoryId}`
  })
}
// 删除仓库
export const deleteRepository = (repositoryId) => {
  return axios({
    method: 'POST',
    url: `repository/deleteRepository/${repositoryId}`
  })
}
// 新增
export const newRepository = (data) => {
  return axios({
    method: 'POST',
    url: 'repository/newRepository',
    data
  })
}
// 编辑
export const updateRepository = (data) => {
  return axios({
    method: 'POST',
    url: 'repository/updateRepository',
    data
  })
}

// 供应商
// 分页
export const pageSupplier = (params) => {
  return axios({
    method: 'GET',
    url: 'supplier/pageSupplier',
    params
  })
}
// 删除供应商
export const deleteSupplier = (supplierId) => {
  return axios({
    method: 'POST',
    url: `supplier/deleteSupplier/${supplierId}`
  })
}

// 供应商详情
export const supplierDetail = (supplierId) => {
  return axios({
    method: 'GET',
    url: `supplier/supplierDetail/${supplierId}`
  })
}
// 新增
export const newSupplier = (data) => {
  return axios({
    method: 'POST',
    url: 'supplier/newSupplier',
    data
  })
}
// 编辑
export const updateSupplier = (data) => {
  return axios({
    method: 'POST',
    url: 'supplier/updateSupplier',
    data
  })
}


//所有通过审批的材料
export const allMaterApprovalList = () => {
  return axios({
    method: 'GET',
    url: 'basicInfo/allMaterApprovalList'
  })
}
